export const getCookie = (name) => {
  if (document.cookie.length > 0) {
    let startIndex = document.cookie.indexOf(name + '=')
    if (startIndex !== -1) {
      startIndex = startIndex + name.length + 1
      let endIndex = document.cookie.indexOf(';', startIndex)
      if (endIndex === -1) {
        endIndex = document.cookie.length
      }
      return document.cookie.substring(startIndex, endIndex)
    }
  }
  return ''
}

export const setCookie = (name, value) => {
  document.cookie = name + '=' + value
}

export const deleteCookie = (name) => {
  setCookie(name, '')
}
